package cn.edu.lsnu.mbti.service.impl;

import cn.edu.lsnu.mbti.entity.Personality;
import cn.edu.lsnu.mbti.mapper.PersonalityMapper;
import cn.edu.lsnu.mbti.service.PersonalityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

@Service
public class PersonalityServiceImpl extends ServiceImpl<PersonalityMapper, Personality> implements PersonalityService {

    @Resource
    private PersonalityMapper personalityMapper;


    /**
     * 查询人格列表
     * @return
     */
    @Override
    public List<Personality> personalityList() {
        return Optional.ofNullable(personalityMapper.selectList(null))
                        .orElse(new ArrayList<>());
    }
}
